﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserDetails : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {        
        if (!IsPostBack)
        {
            BindGrid();            
        }
    }

    private void BindGrid()
    {
        var aa = from a in OnlineexamHelper.context.tbllogins
                 where a.Fk_role_id == 1
                 select
                 new
                 {
                     StudentName = a.fname,
                     Email = a.email,
                 };
        GridView1.DataSource = aa;
        GridView1.DataBind();
        var ss = from a in OnlineexamHelper.context.tbllogins
                 where a.Fk_role_id == 123
                 select
                 new
                 {
                     StudentName = a.fname,
                     Email = a.email,
                 };
        GridView2.DataSource = ss;
        GridView2.DataBind();
        
        var tt = from a in OnlineexamHelper.context.tbllogins
                 where a.Fk_role_id == 12345
                 select
                 new
                 {
                     StudentName = a.fname,
                     Email = a.email,
                 };
        GridView3.DataSource = tt;
        GridView3.DataBind();    
        long role=Convert.ToInt64(Session["role"]);
        if (role == 4080363)
        {
            GridView3.Visible = true;
        }
        else if(role == 12345)
        {
            GridView3.Visible = false;
        }
        else
        {
            GridView3.Visible = false;
        }
    }
}